home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / excl.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  7.6 KB  |  258 lines

  1. /*
  2.  * $Id: excl.trm,v 1.4 1995/12/20 21:47:46 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* Copyright (c) 1992 by P. Klosowski at NIST.  All Rights Reserved 
  7.  *
  8.  * Permission to use, copy, and distribute this software and its
  9.  * documentation for any purpose with or without fee is hereby granted, 
  10.  * provided that the above copyright notice appear in all copies and 
  11.  * that both that copyright notice and this permission notice appear 
  12.  * in supporting documentation.
  13.  *
  14.  * Permission to modify the software is granted, but not the right to
  15.  * distribute the modified code.  Modifications are to be distributed 
  16.  * as patches to released version.
  17.  *  
  18.  * This software  is provided "as is" without express or implied warranty.
  19.  * 
  20.  * This file is included by ../term.c.
  21.  *
  22.  * 
  23.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  24.  *
  25.  ***     $Id: excl.trm,v 1.4 1995/12/20 21:47:46 drd Exp $
  26.      
  27.   NAME
  28.      quic
  29.    PURPOSE
  30.      QUIC driver for GNUPLOT
  31.    NOTES
  32.      
  33.    HISTORY
  34.      przemek - Aug 16, 1992: Created.
  35. ***/
  36. /*
  37. c               *****************************************
  38. c               *****************************************
  39. c               ******                              *****
  40. c               ******   EXCL command definitions   *****
  41. c               ******                              *****
  42. c               *****************************************
  43. c               *****************************************
  44. */
  45.  
  46. /*
  47.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  48.  */
  49.  
  50. #ifndef GOT_DRIVER_H
  51. #include "driver.h"
  52. #endif
  53.  
  54. #ifdef TERM_REGISTER
  55. register_term(excl)
  56. #endif
  57.  
  58. #ifdef TERM_PROTO
  59. TERM_PUBLIC void EXCL_init __P((void));
  60. TERM_PUBLIC void EXCL_graphics __P((void));
  61. TERM_PUBLIC void EXCL_text __P((void));
  62. TERM_PUBLIC void EXCL_linetype __P((int linetype));
  63. TERM_PUBLIC void EXCL_move __P((unsigned int x, unsigned int y));
  64. TERM_PUBLIC void EXCL_vector __P((unsigned int x2, unsigned int y2));
  65. TERM_PUBLIC void EXCL_put_text __P((unsigned int x, unsigned int y, char str[]));
  66. TERM_PUBLIC void EXCL_reset __P((void));
  67.  
  68. #define EXCL_XMAX 9000
  69. #define EXCL_YMAX 6500
  70.  
  71. #define EXCL_XLAST (EXCL_XMAX - 1)
  72. #define EXCL_YLAST (EXCL_YMAX - 1)
  73.  
  74. #define EXCL_VCHAR        120
  75. #define EXCL_HCHAR        70
  76. #define EXCL_VTIC        70
  77. #define EXCL_HTIC        70
  78. #endif /* TERM_PROTO */
  79.  
  80.  
  81. #ifndef TERM_PROTO_ONLY
  82. #ifdef TERM_BODY
  83.  
  84. /*  Define ansi command headers, NUL character */
  85. #define ESC "\033"
  86. #define GS  "\035"
  87. #define CSI "\033["
  88. #define DCS "\033P"
  89. #define ST  "\033\\"
  90.  
  91. /*
  92. page numbers are given per "Talaris EXCL programmer's reference manual" M292 rev.2
  93. NOTE: EXCL coordinate system places (0,0) at upper left corner of the page
  94.  
  95. c EXCL commands for initialization
  96.  
  97. c     TALAMS: set ANSI                                        (p. 162)
  98. c     TALMOD: set emulation *** EXCL                          (p. 164)
  99. c     TALPGO: set page orient *** landscape                   (p.  81)
  100. c     TALFCTL: set paper format *** 8.5x11                    (p.  85)
  101. c     TALTBM: set top/bot margins  ** in land mode to full pg (p.  73)
  102. c     TALLRM: set left/right margins                          (p.  75)
  103. c     PUM:    set units ** units of measure set by TALPRM     (p.  67)
  104. c     TALASF: Absorb cr/ff/lf/vt   ** ON                      (p. 182)
  105. c     TALPOP: pop controller params                           (p. 168)
  106. c     TALPSH: push controller params                          (p. 167)
  107. c     TALPRM: set units of measure ** to 1/1000 inch          (p.  64)
  108. c     TALGLT: set line type ** solid                          (p. 211)
  109. c     TALORG: set page absolute origin ** (0,0) UL corner     (p.  78) 
  110. c     TALPCW: set page clip window *** for landsc/full page   (p.  84)
  111. c     TALGLP: line: **pen7x7mil*draw*smear*glyph112*font5279* (p. 208)
  112. c     TALGLPE: ending for TALGLP command, forcing DRAW mode
  113. c     TALGBB: bounding box; used only by qdrive               (p. 207)
  114. c     TALFPO: Force page out  ** clear bitmap                 (p.  95)
  115. c     TALGDW: graphical draw to hor,vert ** abs  coords       (p. 212)
  116. c     TALGMV: graphical move to hor,vert ** abs  coords       (p. 213)
  117. */
  118. #define TALAMS  "\033[0*s"
  119. #define TALMOD  "\033[1;0r"
  120. #define TALPGO  "\033[1;0p"
  121. #define TALFCTL "\033[0;3x"
  122. #define TALTBM  "\033[0;8500 v"
  123. #define TALLRM  "\033[0;11000v"
  124. #define PUM     "\033[11h"
  125. #define TALASF  "\033[1 z"
  126. #define TALPOP  "\033[*]"
  127. #define TALPSH  "\033[*["
  128. #define TALPRM  "\033[3y"
  129. #define TALGLT  "\033[%s*t"
  130. #define TALORG  "\033[0;0o"
  131. #define TALCCNT "\033[1;0u"
  132. #define TALPCW  "\033[0;8500;11000;0*c"
  133. #define TALGLP_init  "\033[7;7;8;1;112;5279*w"
  134. #define TALGLP  "\033[%d;%d;8*w"
  135. #define TALFPO  "\033[0*F"
  136. #define TALGDW "\033[0;%d;%d*d"
  137. #define TALGMV "\033[0;%d;%d*m"
  138.  
  139. /*  TALPYL: polyline                                        (p. 222)
  140. **        5;0} list of 16-bit signed integers, encoded, mostly relative
  141. **        5,1} list of ASCII  absolute coords (if w/o +- signs)(e.g. 315:1222;)
  142. */
  143.  
  144. #define TALPYL  "\033P5;1}"
  145.  
  146. TERM_PUBLIC void EXCL_init()
  147. {
  148.   fprintf(outfile,"%s%s%s%s%s%s",
  149.                 TALPSH,TALAMS,TALMOD,TALCCNT,TALFCTL,TALASF);
  150. /*                ^save state   ^setEXCL       ^PaperSize8.5x11       */
  151. /*                       ^setANSI      ^copyCount1     ^absorbCtlChar */
  152.   fprintf(outfile, "%s%s%s%s%s%s",
  153.           PUM,TALPRM,TALPGO,TALPCW,TALORG,TALGLP_init);
  154.   fprintf(outfile,                                            TALGLT,"");
  155. /*                ^setUnits  ^landscape    ^OriginZero        ^SolidLine   */
  156. /*                    ^Units1/1000" ^pageClip     ^SetLine            */
  157. }
  158.  
  159. TERM_PUBLIC void EXCL_graphics()
  160. {
  161. }
  162.  
  163. TERM_PUBLIC void EXCL_text()
  164. {
  165.     fprintf(outfile,TALFPO );
  166.     /*              ^pageout  */
  167. }
  168.  
  169.  
  170. TERM_PUBLIC void EXCL_linetype(linetype)
  171. int linetype;
  172. {
  173. /* excl line widths in mils: 4 is mimimum, but too thin; then 
  174.    7,10,14,17,20,24,27...
  175.    exclpen=MOD(NPEN,8)*7
  176.    CSI  exclpen; exclpen; TALGLPE
  177. */
  178.   static char *type[2+9]={ 
  179.     "", "40;40", "",  "42;42",  "14;21",
  180.     /*   ....   ----  -- -- --   . . .   */
  181.      "",  "49;30",  "14;21",         "",  "49;30",  "14;21"
  182.     /*  same pattern, but thicker..  and thicker       */
  183.     };
  184.   static int width[2+9] = {14, 7,    7, 7, 7, 10, 10, 10, 17, 17, 17};
  185.   if (linetype >= 9)
  186.     linetype %= 9;
  187.   fprintf(outfile,TALGLP,width[linetype+2],width[linetype+2]); 
  188.   /*              ^width in dots */
  189.   fprintf(outfile,TALGLT,type[linetype+2]);
  190.   /*              ^line type     */
  191. }
  192.  
  193.  
  194. TERM_PUBLIC void EXCL_move(x,y)
  195. unsigned int x,y;
  196. {
  197.     fprintf(outfile,TALGMV, 1000 + x, EXCL_YLAST + 1000 - y);
  198. /*                     ^pen up vector*/
  199. }
  200.  
  201.  
  202. TERM_PUBLIC void EXCL_vector(x2,y2)
  203. unsigned int x2,y2;
  204. {
  205.     fprintf(outfile,TALGDW, 1000 + x2, EXCL_YLAST + 1000 - y2);
  206. /*                     ^pen down vector*/
  207. }
  208.  
  209.  
  210. TERM_PUBLIC void EXCL_put_text(x,y,str)
  211. unsigned int x,y;
  212. char str[];
  213. {
  214. char ch;
  215.     EXCL_move(x,y - EXCL_VCHAR/3);
  216.     ch = *str++;
  217.     while(ch!='\0') {
  218.         putc(ch,outfile);
  219.         ch = *str++;
  220.     }
  221. }
  222.  
  223. TERM_PUBLIC void EXCL_reset()
  224. {
  225.     fprintf(outfile,"%s%s", TALFPO, TALPOP);
  226.     /*                      ^pageout ^pop  */
  227. }
  228.  
  229.  
  230. #endif /* TERM_BODY */
  231.  
  232. #ifdef TERM_TABLE
  233.  
  234. TERM_TABLE_START(excl_driver)
  235.     "excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  236.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  237.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  238.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  239.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  240.        null_justify_text, line_and_point, do_arrow, set_font_null
  241. TERM_TABLE_END(excl_driver)
  242.  
  243. #undef LAST_TERM
  244. #define LAST_TERM excl_driver
  245.  
  246. #endif /* TERM_TABLE */
  247. #endif /* TERM_PROTO_ONLY */
  248.  
  249. /*
  250.  * NAME: excl
  251.  *
  252.  * OPTIONS: none
  253.  *
  254.  * SUPPORTS: Talaris EXCL Laser printer (also Talaris 1590 and others)
  255.  *
  256.  * Further Info: Who is Talaris?
  257.  *
  258.  */